const inputStr = readline();

const detectColor = (str) => {
    let iV = false;
    if (/(#([0-9a-f]{3}){1,2}|(rgba|hsla)\(\d{1,3}%?(,\s?\d{1,3}%?){2},\s?(1|0?\.\d+)\)|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?\)){2})/i.test(str)) {
        iV = true;
    }
    return iV ? 'valid' : 'invalid';
}
print(detectColor(inputStr.trim()));